//
//  CustomNavigationViewController.m
//  reacticons
//
//  Created by CMC Software on 9/13/12.
//
//

#import "CustomNavigationViewController.h"

@interface CustomNavigationViewController ()

@end

@implementation CustomNavigationViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(0, 0, 48, 26)];
    [button setBackgroundImage:[UIImage imageNamed:@"back_button.png"] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:@"back_button_pressed.png"] forState:UIControlStateSelected];
    [button setTitle:@"  Back" forState:UIControlStateNormal];
    [button.titleLabel setFont:[UIFont fontWithName:@"Impact" size:12]];
    [button setTag:0];
    [button addTarget:self action:@selector(barButtonSelected:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithCustomView:button];
    [self.navigationItem setLeftBarButtonItem:barButton];
    [self.navigationItem setHidesBackButton:YES];
    [barButton release];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)barButtonSelected:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
